//搜索类别
$('#search label').click(function () {
    $(this).addClass("selected").siblings().removeClass("selected");
});
$('#search form').submit(function () {
    var type = $("input[name='type']:checked").val();
    switch(type){
        case "1":
             $(this).attr("action", "/index/search_results");
             break;
        case "2":
             $(this).attr("action", "/index/search_qiye");
             break;
        case "3":
             $(this).attr("action", "/index/source_list");
             break;
         case "4":
             $(this).attr("action", "/index/product_result");
             break;
    }
});
//弹框
function prompt(text, judge) {
    if (judge) {
        $('#alert img').attr("src", "../img/dui.png");
    }
    $('#alert').show();
    $('#prompt').text(text);
    $('body').css({'overflow': 'hidden'});
    $('#alert div b').click(function () {
        $('#alert').hide();
        $('body').css({'overflow': 'auto'});
    });
}
//判断是否登录
var account = Cookie.Get('account');
if (account != undefined && account != false) {
    $('.identity').html(account + "&emsp;个人中心").show().next().show();
    $('.vanish').hide();
}

//退出登录
$('#top div em').click(function () {
    Cookie.Set("account", "", -1);
    Cookie.Set("level", "", -1);
    Cookie.Set("myid", "", -1);
    Cookie.Set("learn", "", -1);
    $('#top .vanish').show().siblings('.identity,em').hide();
});


